﻿using CID.Domain.Audit;
using FluentNHibernate.Mapping;

namespace CID.Domain.Persistence.Mappings.Audit
{
    public class ParameterDeploymentLogMap : EntityMap<ParameterDeploymentLog>
    {
        public const string DiscriminatorColumn = "Type";

        public ParameterDeploymentLogMap () : base()
        {
            Map(x => x.ParameterName).Not.Nullable();
            Map(x => x.ParameterValue).CustomSqlType("NVARCHAR(MAX)");
            References<VersionDeploymentLog>(x => x.VersionDeploymentLog);
            DiscriminateSubClassesOnColumn(DiscriminatorColumn).Length(20);
        }
    }

    public class ActivationParameterDeploymentLogMap : SubclassMap<ActivationParameterDeploymentLog>
    {
        public ActivationParameterDeploymentLogMap()
        {
            DiscriminatorValue("Activation");
        }
    }

    public class DeactivationParameterDeploymentLogMap : SubclassMap<DeactivationParameterDeploymentLog>
    {
        public DeactivationParameterDeploymentLogMap()
        {
            DiscriminatorValue("Deactivation");
        }
    }

    public class DeploymentParameterDeploymentLogMap : SubclassMap<DeploymentParameterDeploymentLog>
    {
        public DeploymentParameterDeploymentLogMap()
        {
            DiscriminatorValue("Deployment");
        }
    }
}
